from celery import shared_task
import time
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = logging.handlers.RotatingFileHandler('/tmp/celery_demo.log', maxBytes=1024, backupCount=10)
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)

@shared_task
def priodically_echo():
    print(time.strftime('------------------------------------%Y-%m-%d %H:%M:%S'))
    logger.info(time.strftime('%Y-%m-%d %H:%M:%S'))
